<?php
class Rating extends AppModel {

	var $name = 'Rating';

	//The Associations below have been created with all possible keys, those that are not needed can be removed
	var $belongsTo = array(
		'Story' => array(
			'className' => 'Story',
			'foreignKey' => 'story_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'User' => array(
			'className' => 'User',
			'foreignKey' => 'user_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);

	function addRating($story_id, $user_id) {
		$res = $this->query('INSERT INTO ' . $this->table . ' (`id`, `story_id`, `user_id`) VALUES (NULL , \'' . $story_id . '\', \'' . $user_id .'\');');
		return $res;
	}
}
?>
